package microservice.controller;

import com.microservice.commonutils.R;
import microservice.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/oss/fileoss")
//@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("uploadfile")
    public R uploadImage(MultipartFile file){

        String url=ossService.uploadFileImage(file);
        return R.ok().data("url",url);
    }

    @GetMapping()
    public String test(){
        return "aaaaaaaaa";
    }
}